#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>

// QtMobility API headers
// Location
#include <qgeopositioninfosource.h>
#include <qgeopositioninfo.h>
// Bearer
#include <qnetworkconfigmanager.h>
#include <qnetworksession.h>

// QtMobility namespace
QTM_USE_NAMESPACE

class PictureItem;
class RetrieveMap;
class RadarView;
//class ContactsDi

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void resizeEvent(QResizeEvent *);

private:
    void showSearchingGpsIcon(bool searching);
    void showMessage(QString msg);
    void createMenu();
    void startGps();

public slots:
    void setupBearer();
    void positionUpdated(QGeoPositionInfo gpsPos);
    void mapImageLoaded(QPixmap);
    void updateMap();
    void storeLocation();
    void findMyCar();
    void showRadarView();

private:
    // Graphics view fw
    QGraphicsScene* m_scene;
    QGraphicsView* m_view;
    RadarView* m_radar;

    // Dialog for selecting contact
//    QPointer<ContactsDialog> m_contactDialog;

    // Google Map API
    RetrieveMap* m_fetchmap;

    // Map picture
    QPixmap m_yourMapPixmap;
    QPointer<PictureItem> m_yourMapItem;

    // Animated message
    QPointer<PictureItem> m_messageItem;

    // Gps logo
    PictureItem* m_gps;
    QPointer<QPropertyAnimation> m_gpsAnim;

    // for bearer management
    QNetworkSession* m_session;

    // Location data
    QPointer<QGeoPositionInfoSource> m_location;
    QGeoPositionInfo m_YougeoPosInfo;
    QGeoPositionInfo m_storedLocation;
    qreal m_car_longitude;
    qreal m_car_latitude;

    bool askLocation;
};

#endif // MAINWINDOW_H
